package com.nbsaas.boot.product.rest.convert;

import com.nbsaas.boot.product.data.entity.ProductModelSpecValue;
import com.nbsaas.boot.product.api.domain.simple.ProductModelSpecValueSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 商品模型规格值-列表对象转换器
*/

public class ProductModelSpecValueSimpleConvert implements Converter<ProductModelSpecValueSimple, ProductModelSpecValue> {




@Override
public ProductModelSpecValueSimple convert(ProductModelSpecValue source) {
    ProductModelSpecValueSimple result = new ProductModelSpecValueSimple();

                result.setNote(source.getNote());

                try {
                    if(source.getSpec()!=null){
                        result.setSpecName(source.getSpec().getName());
                    }
                } catch (Exception ignored) { }

                result.setName(source.getName());
                result.setSortNum(source.getSortNum());
                result.setId(source.getId());

               try {
                   if(source.getSpec()!=null){
                       result.setSpec(source.getSpec().getId());
                   }
                } catch (Exception ignored) { }



    return result;
}

}